Method and system for computer graphics rendering

ABSTRACT

A method and system of computer graphics rendering implemented upon a processor in communication with a memory device storing a data comprises: loading a data structure representing at least a part of a scene in world space for display into the processor; a transform module transforming the data structure from world space to clip space; a dividing module subdividing the data structure in clip space so as to form child data structures; and a testing module testing which of the plurality of child data structures are within a viewing frustum, so that child data structures outside of the viewing frustum are discarded and a plurality of remaining nodes are retained. The plurality of remaining data structures are subsequently subdivided and tested until the plurality of remaining data structures do not overlap with the viewing frustum. A display module processing the plurality of remaining data structures for generation of an image on a display device.

FIELD OF THE INVENTION

The present invention relates to a method for computer graphicsrendering of data structures and a system for rendering computergraphics for display.

BACKGROUND

Computer graphics rendering is the process of converting 2D or 3D modelsinto a generated image for a display on a display screen. For thegeneration 3D computer graphics, an octree may be used for partitioninga three dimensional space. This partitioning is achieved by recursivelysubdividing the space into eight octants, to a point where furthersubdivision is redundant for a given resolution.

Conventionally, the calculation and processing of the octree isconducted by general-purpose computing on graphics processing units(GPGPU). In this situation, the octree data is loaded onto a GPGPUrendering pipeline for processing. As the processing of the octree isconducted by subdivision in world space with subsequent frustum cullingin world space, this process becomes impractical for a large octree dueto memory limitations of the graphics processing unit(s). In order tocircumvent this issue, the part of the octree that can be seen in aviewing frustum is loaded on demand. Unfortunately with dynamic viewing,this requires constant updates of the loaded portion of the octree,which becomes impractical.

An alternative solution to the issue would be to use a plurality ofcentral processing units to create an image of the octree and display iton the electronic display screen by bit block transfer. Normally theprocess of determining which nodes of the octree are within the viewingfrustum and transforming their contents to create the image arecomputationally too expensive to accomplish this at any reasonable framerate.

It would be advantageous if a computer graphics rendering method fordisplaying 3D computer graphics based on data structure (such as octree)calculations was provided that overcame the problems discussed above orwhich is at least a useful alternative to those methods that have beenknown.

SUMMARY OF INVENTION

According an aspect of the invention, there is provided a method ofcomputer graphics rendering implemented upon a processor, the methodcomprising:

loading a data structure representing at least a part of a scene inworld space for display into the processor;

transforming the data structure from world space into clip space;

subdividing the data structure in clip space so as to form child datastructures, each child data structure comprising at least one node;

testing which of the plurality of child data structures are within aviewing frustum, so that child data structures outside of the viewingfrustum are discarded and a plurality of remaining nodes are retained;

wherein the plurality of remaining data nodes are subsequentlysubdivided and tested until the plurality of remaining data nodes do notoverlap with the viewing frustum, and processing the plurality ofremaining data nodes for generation of an image on a display device.

According to an embodiment of the invention, the world space datacomprises a parent octree.

In an embodiment transforming the data structure from world space toclip space comprises transforming the parent octree node from worldspace to clip space.

In an embodiment subdividing the data structure in clip space so as toform child data structures comprises subdividing the parent octree nodein clip space so as to form child octree nodes.

In an embodiment the plurality of remaining nodes are further repeatedlysubdivided into a plurality of new child nodes and tested before theplurality of remaining nodes are processed for generation of an image onthe electronic display device.

In an embodiment the plurality of remaining nodes are recursivelysubdivided and tested to be within the viewing frustum until a stopcondition is met.

In an embodiment the stop condition is met when the size of a pluralityof remaining nodes is too small to effectively display on the displayscreen.

In an embodiment the image is generated on the electronic display deviceby bit block transfer.

According to another aspect of the invention, there is provided a systemof computer graphics rendering, the system comprising:

a processing unit in communication with a memory device storing a data,wherein the processing unit is arranged to control a display device,wherein the processing unit is arranged to create or load a datastructure representing at least a part of a scene in world space fordisplay;a transform module for transforming the data structure from world spaceto clip space; a dividing module for subdividing the data structure inclip space so as to form child data structures;a testing module for testing which of the plurality of child datastructures are within a viewing frustum, so that child data structuresoutside of the viewing frustum are discarded and a plurality ofremaining nodes are retained;wherein the plurality of remaining data structures are subsequentlysubdivided and tested until the plurality of remaining data structuresdo not overlap with the viewing frustum, and a display module forprocessing the plurality of remaining data structures for generation ofan image on a display device.

According to an embodiment of the invention, the division module isconfigured such that the plurality of remaining nodes are furthersubdivided into a plurality of new child nodes and the method repeatedfrom the beginning before the plurality of remaining nodes aresubsequently processed to generate an image on the electronic displaydevice.

In an embodiment the division module is configured such that theplurality of remaining nodes are recursively subjected to subdivisionand testing to be within the viewing frustum until the size of aplurality of remaining nodes are too small to effectively display on theelectronic display screen.

According to a preferred embodiment of the invention, the system furthercomprises a bit block transfer module for transfer of the data structurerepresenting the image to a GPU for generation of the image on thedisplay device.

According to another aspect of the present invention there is provided acomputer program comprising instructions for controlling a processor toperform the method described above.

Throughout the specification and claims, unless the context requiresotherwise, the word “comprise” or variations such as “comprises” or“comprising”, will be understood to imply the inclusion of a statedinteger or group of integers but not the exclusion of any other integeror group of integers.

DESCRIPTION OF DRAWINGS

In order to provide a better understanding of the present inventionembodiments will now be described by way of example only, with referenceto the drawings, in which:—

FIG. 1 illustrates a computer system for implementing a method accordingto an embodiment of the present invention;

FIG. 2 illustrates a wireframe cube comprising a simple scene;

FIG. 3 illustrates a subdivided octree of the cube of FIG. 2;

FIG. 4 illustrates a flowchart of a typical rendering pipeline;

FIG. 5 is an alternative representation of the method of FIG. 4;

FIG. 6 illustrates a flowchart of the method according to an embodimentof the present invention and

FIG. 7 illustrates a set of functional modules of a processor and datatransfer between the modules according to an embodiment of the presentinvention.

DESCRIPTION OF EMBODIMENTS

FIG. 1 shows a block diagram of a typical computer system 10 forcarrying out a method of computer graphics rendering according to anembodiment that will be described. The computer system 10 may be forexample, a personal computer, a gaming console, a tablet, a smart phoneor a dedicated computing system for example a medical imaging device.

In an embodiment the computer system 10 comprises a central processingunit based system for carrying out the method. The system 10 comprises amother board 12 which is capable of powering and interfacing to at leastone central processing unit 14. The central processing unit 14 may beconfigured to have a plurality of discrete processors or processors withmultiple processing cores. Examples of the central processing unit arethe Core series of processors manufacture by Intel Corp or the FX seriesof processors manufactured by Advanced Micro Devices Inc.

A storage drive 16 is interfaced to the motherboard 12. The storagedrive 16 may comprise one or more typical storage drives, such as by wayof example, hard disk drives or solid state drives. An operating system18 is stored in the storage drive 16 in order to provide instructions tothe computer system 10. The mother board 12 is also in communicationwith a random access memory 20 and a read only memory 22. The randomaccess memory 20 is typically used as temporary storage and workingspace for the operating system. The read only memory 22 is typicallyused to store instructions for a Basic Input Output System which isaccessed by the central processing unit 12 to prepare the computersystem 10 to load the operating system 18. An optical device 36 may beinterfaced to the mother board 12 to allow access to an optical storagedevice, such as a CD, DVD, or Blu-ray.

A graphics processor unit 24 is interfaced to the motherboard 12. Thegraphics processor unit 24 may also be arranged so as to be integratedto the mother board 12 or the central processing unit 14.

The mother board 12 may include a network interface module 32, such asby way of example, a local area network adaptor or a wireless networkadaptor. The network interface module 32 allows the computer system 10to connect to a computer network 34, such as by way of example, theinternet. The computer program described below, or data for the computerprogram may be obtained from the computer network 34.

The computer system 10 is interfaced by a user by means of peripherals,such as by way of example, a keyboard 28, a mouse 21 and a displayscreen 26. The display screen 26 may be of any suitable type, such as byway of example, a liquid crystal display, a light emitting diode displayor a cathode ray tube display. The graphics processor unit 24 controlsthe images displayed on the display screen 26. The computer system 10 isconfigured by modules, which may comprise sub-modules, which interactwith and exchange data to perform the present invention. The modules maybe implemented in hardware, that is as electronic circuits, or in theform of functional arrangements 100 implemented by instructions thatcontrol the CPU(s) and/or GPU(s). The control instructions are commonlyreferred to as computer programs. The computer programs are embodied ina non-transitory computer readable medium 38, such as a permanentoptical, magnetic or other electronic storage medium.

A computer graphics software 40 is installed upon the computer system10. The software 40 may be regarded as the data generator 102 in FIG. 6.The computer graphics software 40 may be a part of an application thatrequires display of, for example, one or more objects on the displayscreen 26. The computer graphics software 40 contains or creates datastructures for storing data in computer memory to define images andinstructions so that the computer graphics software may alter the imagesin response to inputs via the peripherals. For example the softwareapplication may be a computer game that displays objects that form ascene for the user to interact with according to the game, in a mannerwhere a user input produces a dynamic response to the displayed objectsand thus the scene.

The data structures are typically in the form of positional coordinatesthat require processing, such as in a render pipeline in order totransform the data from 3D coordinates into 2D graphics for displayingupon the electronic display screen 26. The processing is typicallycomputationally large due to the calculations required to transform the3D coordinates into 2D graphics that mimic perspective and object sizeaccording to distance from a selected viewpoint. In order to simplifyprocesses and reduce the computational requirements of processing thedata structures, a preferred data structure of an octree may be used.The octree is a simple equal distance binary recursive subdivision ofspace starting from an initial cube that contains all the data. Analternative data structure to an octree is a binary space positioningtree.

FIG. 2 shows a wireframe cube 42 for rendering in order to be displayedon the electronic display screen 26. The data of the wireframe cube 42is stored as an octree data structure. In this situation, the cube 42would be considered as a node.

FIG. 3 shows the cube 42 becoming a parent node by the subdivision intoeight octants, wherein each octant is a child node 44. Additionally,each child node 44 may itself become a parent node by subdivision intoeight octants, wherein each octant is a further child node 46. In thissituation, the octree data structure may be recursive in nature as eachnode may be subdivided until a set parameter is met. Typically theprocess of determining the subdivision of octree coordinates is byaveraging those of the parent node.

In order to determine what parts of an octree are to be included in a 2Dgraphic for displaying upon the display screen 26, the individual nodes42, child nodes 44 and further child nodes 46 are subjected to testingby a testing module. The testing, also known as frustum culling,comprises having a viewing frustum, which defines the portion of theoctree to be displayed upon the electronic display screen 26, projectupon the octree. The testing module then determines whether theindividual node 42 falls within the viewing frustum. If the individualnode 42 falls outside of the viewing frustum, the individual node 42 isnot displayed upon the electronic display screen 26 and is discarded. Ifthe individual node 42 falls within the viewing frustum, the associatedchild nodes 44 will undergo the test. This process is recursivelyrepeated until a level is reached where the size of the subsequentchildren nodes reach a size parameter, such as a size that is too smallto effect to the electronic display screen 26, or a size that is at orbelow a desired resolution.

FIG. 4 shows a typical rendering pipeline flowchart 47. The renderingpipeline flowchart 47 displays the data coordinates and thetransformations required to progress from the original data structurecoordinates to a final display coordinate for displaying to the displayscreen 26. The process involves having a set of coordinates in objectspace 48 undergoing a modelling transformation 49 to have thecoordinates converted into a set of coordinates in world space 50. Themodel coordinates are represented by 4 dimensional homogeneouscoordinates (x, y, z, w) of vertex positions, with w usually being 1 forobject coordinates within the model view and projection matrices beinglinear transformations. The set of coordinates in world space 50 undergoa view transformation 51 to have the coordinates converted into a set ofcoordinates in eye space 52. The set of coordinates in eye space 52undergo a projection transformation 54, which may be either perspectiveor orthogonal, to have the coordinates converted into a set ofcoordinates in clip space 56. The set of coordinates in clip space 56undergo a perspective division 58 by its w to have the coordinatesconverted into a set of coordinates in normalised device space 60. Theremay be implementation specific variations of the transformation to clipspace according to, for example, whether OpenGL or Direct3D is used. Thetransformation from clip space to normalised device coordinates (NDC) innormalised device space 60 is non-linear. The set of coordinates innormalised device space 60 undergo a viewport and depth rangetransformation 62 to have the coordinates converted into a set ofcoordinates in window space 64 which may then be displayed on thedisplay screen 26.

It is generally known that the portion in which data structures, such asthe octree mentioned above, are subjected to the testing is when thedata structure is found as a set of coordinates in world space 50. Afterdetermining which nodes are to be displayed on the electronic displayscreen 26, the nodes undergo the multitude of transformations until theyare transformed into the set of coordinates in window space 64 in orderto be displayed on the electronic display screen 26. It is known thatthe testing is computationally intensive and the whole process istypically shunted to the rendering pipeline located on the graphicsprocessing unit 24. Furthermore, it is possible to have the centralprocessing unit 14 assist the graphics processing unit 24 by running aparallel rendering pipeline.

In the present invention the method of computer graphics renderingdiffers from known techniques, in that the testing is conducted when thecoordinates in world space 50 have been transformed into coordinates inclip space 56. FIG. 5 shows a flowchart wherein the individual node inworld space 42A undergoes a view and projection transformation 66conducted by a transform module 106 to result with the individual nodein clip space 42B. The individual node 42 undergoes a subdivisionprocess 68 of averaging the corners of a plurality of child nodes inclip space 70 by a dividing module 110 prior to being tested by thetesting module 116. The testing involves a first step 72 wherein theviewing frustum is projected upon the plurality of child nodes in clipspace 70 and child nodes not overlapping with the viewing frustum arediscarded, producing a view frustum with remaining child nodes 74. Theplurality of child nodes that overlap with the viewing frustum undergo afurther subdivision and test 76 to produce a plurality of further childnodes. If the plurality of further child nodes 78 still retains nodesthat are outside of (i.e. not fully within) the viewing frustum, thesefurther child nodes undergo further subdivision and processing untilthere are no longer any overlap of nodes with the viewing frustum,producing a plurality of culled nodes and retained nodes 78. Theplurality of retained nodes 78 undergo subsequent transformations in adisplay module 122 for display on the display screen 26. Because the NDCrepresents the view frustum as a 3 dimensional cube from (−1, −1, −1) to(1, 1, 1) and is obtained by dividing each clip coordinate by its w itthen becomes apparent that frustum culling in clip space is simply doneby constraining each coordinate to the range −w to +w.

The plurality of retained nodes 78 may be subjected to a recursive loop82 of further subdivision and testing, until a required depth orresolution is reached. This produces images more quickly for display onthe display screen 26 in comparison to known techniques.

Additionally, the plurality of retained nodes 78 may be displayed on thedisplay screen 26 by bit block transfer.

The combined transformation from object to clip coordinates is linearonce the top node of the octree is transformed to clip space. The clipspace coordinates of the child nodes of the octree can be obtained usingthe same averaging procedure used in object space. Now having the octreecoordinates in clip space these can be used and the simple comparisonsfor view frustum culling in clip space can be performed to efficientlytraverse the octree and obtain the data required to produce an image to“blit” to the screen. Additionally, clip space in the x and y directionsmap directly to the horizontal and vertical window axes in aproportional manner. Hence it is possible to map clip space x, y towindow space pixels and hence determine when the dimensions of the nodeare smaller than a pixel and too small to effect the display so as todetermine the stop condition of the recursive subdivision of nodes.

The invention advantageously provides a method of computer graphicsrendering in which the testing is reduced in complexity so that it iscomputationally relaxed compared to the typical method. As such, themethod of computer graphics rendering allows the central processing unit14 to conduct the transformation of positional coordinates via therendering pipeline in a manner that does not require the graphicsprocessing unit 24 to be actively employed. Furthermore, due to improvedefficiency the method of computer graphics rendering allows for theoctree structures to be displayed on the electronic display screen 26 atreal time frame rates.

Modifications may be made to the present invention within the context ofthat described and shown in the drawings. Such modifications areintended to form part of the invention described in this specification.

The invention claimed is:
 1. A method of computer graphics renderingimplemented upon a processor, the method comprising: loading a datastructure representing at least a part of a scene in world space fordisplay into the processor; transforming the loaded data structure fromworld space into clip space; recursively: subdividing the transformeddata structure in clip space so as to form a plurality of child datastructures, each child data structure comprising at least one node;testing which of the plurality of child data structures in eachrecursion are within a viewing frustum, so that child data structuresoutside of the viewing frustum are discarded and a plurality ofremaining nodes are retained; wherein the plurality of remaining datanodes become parent nodes of the transformed data structure for furthersubdivision in another recursion until the plurality of remaining datanodes do not overlap with the viewing frustum, and processing theplurality of remaining data nodes for generation of an image on adisplay device.
 2. A method as claimed in claim 1, wherein the datastructure in world space comprises a parent octree.
 3. A method asclaimed in claim 2, wherein transforming the data structure from worldspace to clip space comprises transforming the parent octree node fromworld space to clip space.
 4. A method as claimed in claim 2, whereinsubdividing the transformed data structure in clip space so as to formchild data structures comprises subdividing the parent octree node inclip space so as to form eight child octree nodes.
 5. A method asclaimed in claim 1, wherein the recursion ends when the size of aplurality of remaining nodes is too small to effectively display on thedisplay screen.
 6. A method as claimed in claim 1, wherein the image isgenerated on the electronic display device by bit block transfer.
 7. Amethod as claimed in claim 1, wherein the loaded data that istransformed includes data structures that reference at least one objectthat is outside of the viewing frustum.
 8. A method as claimed in claim1, wherein the transforming step is not preceded by a step that cullsobjects that are outside of the viewing frustum.
 9. A system of computergraphics rendering, the system comprising: a processing unit incommunication with a memory device storing a data, wherein theprocessing unit is arranged to control a display device, wherein theprocessing unit is arranged to create or load a data structurerepresenting at least a part of a scene in world space for display; atransform module for transforming the data structure from world space toclip space; a dividing and testing module for recursively: subdividingthe transformed data structure in clip space so as to form a pluralityof child data structures, each child data structure comprising at leastone node; testing which of the plurality of child data structures ineach recursion are within a viewing frustum, so that child datastructures outside of the viewing frustum are discarded and a pluralityof remaining nodes are retained; wherein the plurality of remaining datanodes become parent nodes of the transformed data structure for furthersubdivision in another recursion until the plurality of remaining datastructures nodes do not overlap with the viewing frustum, whereupon therecursion ends, and a display module for processing the plurality ofremaining data structures for generation of an image on the displaydevice.
 10. A system as claimed in claim 9, wherein the processing unitis configured to create or load the data structure in world space sothat the data structure comprises a parent octree; the transform moduleis configured to transform nodes of the parent octree from world spaceto clip space; and the dividing and testing module is configured tosubdivide the transformed nodes of the parent octree in clip space so asto form eight child octree nodes.
 11. A system as claimed in claim 9,wherein the dividing and testing module is configured such that theplurality of remaining nodes that do not overlap with the viewingfrustum are recursively subjected to the subdivision and testing untilthe size of a plurality of remaining nodes are too small to effectivelydisplay on the electronic display screen.
 12. A system as claimed inclaim 9, wherein the display module comprises a bit block transfermodule for transferring the data structure representing the image to aGPU for generation of the image on the display device.
 13. A processorand a non-transitory storage medium storing computer readableinstructions, the processor configured to perform the method accordingto claim
 1. 14. A processor and a non-transitory storage medium storingcomputer readable instructions, the processor configured to perform themethod according to claim
 2. 15. A processor and a non-transitorystorage medium storing computer readable instructions, the processorconfigured to perform the method according to claim
 3. 16. A processorand a non-transitory storage medium storing computer readableinstructions, the processor configured to perform the method accordingto claim
 4. 17. A processor and a non-transitory storage medium storingcomputer readable instructions, the processor configured to perform themethod according to claim
 5. 18. A processor and a non-transitorystorage medium storing computer readable instructions, the processorconfigured to perform the method according to claim
 6. 19. A processorand a non-transitory storage medium storing computer readableinstructions, the processor configured to perform the method accordingto claim
 7. 20. A processor and a non-transitory storage medium storingcomputer readable instructions, the processor configured to perform themethod according to claim 8.